/*
--------------------------------------------------
备注: 打包入口文件；打包将采用umd规范，适合amd和cmd引用；
--------------------------------------------------
*/
// 批量导入组件
import Button from '../packages/button/'
import ButtonGroup from '../packages/button-group/'
import Alert from '../packages/Alert/'
import Col from '../packages/col/'
import Row from '../packages/row/'
import Container from '../packages/container/'
import Header from '../packages/header/'
import Main from '../packages/main/'
import Footer from '../packages/footer/'
import Aside from '../packages/aside/'

// 组件列表，用于全局注册、按需加载打包；
const components = [
  Alert,
  Button,
  ButtonGroup,
  Row,
  Col,
  Container,
  Header,
  Main,
  Footer,
  Aside
]
const install = (Vue, options = {}) => {
  // 合并默认配置，用于后续安装其他插件；
  const _options = {}
  options = Object.assign({}, _options, options)
  console.log('<<<install options', options)
  // 全局注册
  components.forEach(component => {
    Vue.component(component.name, component)
  })

  // 全局组件例如Toast、Modal等
  // Vue.propertype.$toast = Toast
  // Vue.propertype.$modal = Modal

  // 国际化vue-i18n,需要用到options
}
// 如果是浏览器环境,自动注册
if (typeof window !== 'undefined' && window.Vue) {
  install(window.Vue, {})
}

export default {
  Alert,
  Button,
  ButtonGroup,
  components,
  Col,
  Row,
  Container,
  Footer,
  Header,
  install,
  Main,
  Aside,
  version: ''
}
